import { ref, defineComponent, PropType } from 'vue'
import type { FormInstance } from 'element-plus'
import TableContext from '../zlrt-table/table-context'

export default defineComponent({
  props: {
    p: {
      type: Object as PropType<TableContext>,
      required: true,
      default: () => null
    }
  },
  setup() {
    const ruleFormRef = ref<FormInstance>()

    const reset = (p) => {
      p.filter = {}
      p.otherFilter = {}
      p.loadData()
    }

    const onSubmit = (p) => {
      p.loadData()
    }

    return {
      ruleFormRef,
      reset,
      onSubmit
    }
  }
})
